import axios from '../utils/axios'

module.exports = async (ctx) => {
  // 获取城市
  const city = ctx.store ? ctx.store.state.geo.position.city : ctx.query.city
  const {
    status,
    data: {
      result
    }
  } = await axios.get('http://cp-tools.cn/search/hotPlace', {
    params: {
      city
    }
  })
  ctx.body = {
    result: status === 200 ? result : []
  }
}
